package com.rpp.study.feign;

import com.rpp.study.base.LagouResponse;
import com.rpp.study.hystrix.HystrixEmailFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @Description
 * @Author rpp
 * @Date 2020/8/28 10:35 下午
 */
@FeignClient(value = "service-email", path = "/api/email", fallbackFactory = HystrixEmailFactory.class)
public interface FeignEmail {

    /**
     * 发送验证码到邮箱，true成功，false失败
     *
     * @param email
     * @return
     */
    @PostMapping(value = "/send/{email}/{code}", consumes = MediaType.APPLICATION_JSON_VALUE)
    LagouResponse<Boolean> sendEmail(@PathVariable("email") String email,
                                     @PathVariable("code") String code);
}
